<html>
<head> <#include "../StaticFile.ftl"></head>
<body>

<div id="dlg"  style="width:290px;height:170px;padding:10px;padding-left:500px;padding-top:200px;">
       
       <form action="" method="post" id="login_form">
            <table cellpadding="5">
                <tr>
                    <td>用户名:</td>
                    <td>
      <input class="easyui-textbox" type="text" name="username" id="username" >
                 
                    </td>
                </tr>
                <tr>      
                    <td>密码:</td>
                    <td><input class="easyui-textbox" type="password" id="password" name="password" ></input></td>
                </tr>
                
              </table>
              <div style="text-align:center;padding:5px">
            <a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitForm()">登陆</a>
            <a href="javascript:void(0)" class="easyui-linkbutton" onclick="$('#dlg').dialog('close');">取消</a> 
            <img  src="/css/images/loading.gif" style="display:none" id="loading" />
         </div>
         
         </form>
</div>

<script>



function submitForm()
{
   var loading=$("#loading");
   loading.show();
   $.ajax({ type: "POST",
                url: "/user/auth",
                data:{
                username:$("#username").textbox("getValue"),
                password:$("#password").textbox("getValue")
                },
                success: function(data)
                 {
                    var result=jQuery.parseJSON(data);
                    loading.hide();
                    if(result.code==0)
                    {
                        window.location.href=result.target;
                    }
                    else
                    {
                        alert(result.msg);
                        $("#username").textbox("setValue","");
                        $("#password").textbox("setValue","")
                    }
                 }
                 });
}
</script>
</body>
</html>